<?
// handle errors
handle_error($errors);
?>
<!DOCTYPE HTML><html>
<head>
<? echo $h->meta($title, $kwd, $dpn); ?>
<? require_once("lib.php"); ?>
<script src="<?=$ecom?>/js/jquery.validate.js" type="text/javascript"></script>
<script src="<?=$ecom?>/js/jquery.metadata.js" type="text/javascript"></script>
</head>
<body id="">
<? include_once("header.php"); ?>
<div id="wrap">
	<div class="breadcrumb">
		<a href="./"><?=WEB_INDEX_PAGE?></a> &gt; <span><?=WEB_REGISTER?></span>
	</div><!--breadcrumb end-->
	<div id="login" class="">
		<div class="login register">

		<div class="login_box left">
		<div class="login_boxer">
			<form method="post" class="need_check">
				<? 
				// 签名以过滤非法提交表单
				$key=md5('ecomgear'.date('Ymd'));
				echo $h->hidden('key',$key);
				echo $h->hidden('action','register'); ?>
				<h2><?=WEB_REGISTER?></h2>
				<table>
					<tr>
						<td width="88" class="tright"><span class="error">*</span> <?=WEB_EMAIL?>: </td><td><input type="text" class="g" name="email" /></td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_PASSWORD?>: </td>
						<td>
							<input type="password" id="password" 
							class="g {validate:{required:true, minlength:6, messages:{required:'<?=WEB_PASSWORD_REQUIRED?>', minlength:'<? printf(WEB_PASSWORD_MIN_LENGTH,6)?>'}}}" name="password" />
						</td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_CONFIRM_PASSWORD?>: </td><td><input type="password" class="g {validate:{required:true, equalTo:'#password', messages:{required:'<?=WEB_CONFIRM_PASSWORD_REQUIRED?>',equalTo:'<?=WEB_PASSWORD_AND_CONFIRM_PASSWORD_MISMATCH?>'}}}" name="repassword" /></td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_CAPTCHA?>: </td><td><input type="text" class="gs" name="code" /> &nbsp; <img src="api_ver_code.php" width="72" /> <span class="error"></span></td>
					</tr>
					<tr>
						<td>&nbsp;</td><td><input type="submit" class="button_blue" value="<?=WEB_AGREED_TERM_AND_REGISTER?>" /> &nbsp; <a class="blue" href="help-1.html"><< <?=WEB_REGISTRATION_AGREEMENT?> >></a>
					</td>
					</tr>
				</table>
			</form>
		</div>
		</div>


		<!-- 手机注册 -->
		<div class="login_box left">
		<div class="login_boxer">
			<form method="post" id="sjForm">
				<? 
				// 签名以过滤非法提交表单
				$key=md5('ecomgear'.date('Ymd'));
				echo $h->hidden('key',$key);
				echo $h->hidden('action','register'); ?>
				<h2>手机<?=WEB_REGISTER?></h2>
				<table>
					<tr>
						<td width="88" class="tright"><span class="error">*</span> 手机号: </td>
						<td><input type="text" class="g {validate:{required:true, minlength:6, messages:{required:'请输入手机号', minlength:'手机号不能少于11位'}}}" name="phone" /></td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_PASSWORD?>: </td>
						<td>
							<input type="password" id="password_2" class="g {validate:{required:true, minlength:6, messages:{required:'<?=WEB_PASSWORD_REQUIRED?>', minlength:'<? printf(WEB_PASSWORD_MIN_LENGTH,6)?>'}}}" name="password_2" />
						</td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_CONFIRM_PASSWORD?>: </td>
						<td>
							<input type="password" class="g {validate:{required:true, equalTo:'#password_', messages:{required:'<?=WEB_CONFIRM_PASSWORD_REQUIRED?>',equalTo:'<?=WEB_PASSWORD_AND_CONFIRM_PASSWORD_MISMATCH?>'}}}" name="repassword_2" />
						</td>
					</tr>
					<tr>
						<td class="tright"><span class="error">*</span> <?=WEB_CAPTCHA?>: </td><td><input type="text" class="gs" name="code" /> &nbsp; <img src="api_ver_code.php" width="72" /> <span class="error"></span></td>
					</tr>
					<tr>
						<td>&nbsp;</td><td><input type="submit" class="button_blue" value="<?=WEB_AGREED_TERM_AND_REGISTER?>" /> &nbsp; <a class="blue" href="help-1.html"><< <?=WEB_REGISTRATION_AGREEMENT?> >></a>
					</td>
					</tr>
				</table>
			</form>
		</div>
		</div>
		<!-- 手机注册 -->

		<div class="right"><img src="<?=$ecom?>/images/login_show.jpg" /></div>
	</div><!--#register-->
		<div class="clear"></div>
	<div class="px20"></div>
	<div class="clear"></div>
</div></div>
<? include("footer.php"); ?>
<script type="text/javascript">



  $(document).ready(function(){
	jQuery.validator.addMethod("email_same", function(value, element) {
	var flag = 1;
	$.ajax({
		data:{'email':value},
		type:"GET", url:'ajax_email.php', async:false,
		success: function(msg){ if(msg == 'yes'){ flag = 0; } }	
	});
	if(flag == 0) return false; else return true;
	}, "<?=WEB_EMAIL_ALREADY_USED?>");

	jQuery.validator.addMethod("ver_code", function(value, element) {
	var flag = 0;
	if(value.length < 4) return true;
	$.ajax({
		type:"GET", url:'ajax_ver_code.php', async:false,
		data:{'code':value},
		success: function(msg){ if(msg == 'yes'){ flag = 1; } }
	});
	if(flag == 0) return false; else return true;
	}, "<?=WEB_INPUT_ERROR?>");

	$("#sjForm").validate({meta: "validate",
  		rules:{
  			email:{required:true,email:true,email_same:true},
  			code:{required:true,ver_code:true,minlength:4}
  		},
  		messages:{
  			email:{
  				required:'<?=WEB_EMAIL_REQUIRED?>',
  				email:' <?=WEB_INVALID_EMAIL?> '
  			},
  			code:{required:'<?=WEB_CAPTCHA_REQUIRED?>  *'
  			}
  		},
		onkeyup: false,
		errorPlacement: function( label, element ) {
			element.parent().append("<br>").append(label);
		}
  });


	// class need_check
  	$(".need_check").validate({meta: "validate",
  		rules:{
  			email:{required:true,email:true,email_same:true},
  			code:{required:true,ver_code:true,minlength:4}
  		},
  		messages:{
  			email:{
  				required:'<?=WEB_EMAIL_REQUIRED?>',
  				email:' <?=WEB_INVALID_EMAIL?> '
  			},
  			code:{required:'<?=WEB_CAPTCHA_REQUIRED?>  *'
  			}
  		},
		onkeyup: false,
		errorPlacement: function( label, element ) {
			element.parent().append("<br>").append(label);
		}
  });
});
</script>
</body>
</html>